<?php
/**
* Event : Define Events
*/

class Event {
	/**
     * ID of the event
     * @var int
     */
    public $id;

    /**
     * Title
     * @var string
     */
    public $title;

    /**
     * Description
     * @var string
     */
    public $description;

    /**
     * Start time
     * @var string
     */
    public $start;

    /**
     * End time
     * @var string
     */
    public $end;
	
	/**
	* Converts arrays to Event Objects
	* @param array $event Array with event data
	*/
	
	protected function __construct($event){
		if(is_array($event)){
			$this->id = $event['event_id'];
            $this->title = $event['event_title'];
            $this->description = $event['event_desc'];
            $this->start = $event['event_start'];
            $this->end = $event['event_end'];
		}else{//create a new object
			throw new Exception("Wrong constructor parameter, an array was expected.");
		}
		
	}

}

?>